[IA64] Follow new interrupt deliver mechanism for PV-on-HVM/IPF
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 20 Dec 2006 15:53:42 +0000 (08:53 -0700)
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 20 Dec 2006 15:53:42 +0000 (08:53 -0700)
This fixes PV-on-HVM drivers for ia64

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
xen/arch/ia64/vmx/vmx_process.c
xen/include/public/arch-ia64.h

index 3a2453a25c4031b9db02620e14e3db794d451f7d..b529ce1308cc537e1e9a0502b6fb0a68a9a3b92e 100644 (file)
@@ -182,12 +182,17 @@ static int get_hypercall_stubs(void)
 static int get_callback_irq(struct pci_dev *pdev)
 {
 #ifdef __ia64__
-       int irq;
+       int irq, rid;
        for (irq = 0; irq < 16; irq++) {
                if (isa_irq_to_vector(irq) == pdev->irq)
                        return irq;
        }
-       return 0;
+       /* use Requester-ID as callback_irq */
+       /* RID: '<#bus(8)><#dev(5)><#func(3)>' (cf. PCI-Express spec) */
+       rid = ((pdev->bus->number & 0xff) << 8) | pdev->devfn;
+       printk(KERN_INFO DRV_NAME ":use Requester-ID(%04x) as callback irq\n",
+              rid);
+       return rid | HVM_PARAM_CALLBACK_IRQ_RID;
 #else /* !__ia64__ */
        return pdev->irq;
 #endif
index 94011beb71b47daaef80058722572e811769a37a..1fce5524b5ead0eb3d3641f11b37fe0eb3ea1fae 100644 (file)
@@ -212,8 +212,17 @@ void leave_hypervisor_tail(struct pt_regs *regs)
             if (callback_irq != 0 && local_events_need_delivery()) {
                 /* change level for para-device callback irq */
                 /* use level irq to send discrete event */
-                viosapic_set_irq(d, callback_irq, 1);
-                viosapic_set_irq(d, callback_irq, 0);
+                if (callback_irq & HVM_PARAM_CALLBACK_IRQ_RID) {
+                    /* case of using Requester-ID as callback irq */
+                    /* RID: '<#bus(8)><#dev(5)><#func(3)>' */
+                    int dev = (callback_irq >> 3) & 0x1f;
+                    viosapic_set_pci_irq(d, dev, 0, 1);
+                    viosapic_set_pci_irq(d, dev, 0, 0);
+                } else {
+                    /* case of using GSI as callback irq */
+                    viosapic_set_irq(d, callback_irq, 1);
+                    viosapic_set_irq(d, callback_irq, 0);
+                }
             }
         }
 
index 65cc233af3137d0e50c8b9edbd0b44e13f9fcd11..b2830f6c66c5897aadd6bb5c4448e78691ad477c 100644 (file)
@@ -62,6 +62,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define VIRQ_MCA_CMC    VIRQ_ARCH_1 /* MCA cmc interrupt */
 #define VIRQ_MCA_CPE    VIRQ_ARCH_2 /* MCA cpe interrupt */
 
+/* Arch specific callback irq definition */
+/* using Requester-ID(RID) as callback irq */
+#define HVM_PARAM_CALLBACK_IRQ_RID        (1 << 31)
+
 /* Maximum number of virtual CPUs in multi-processor guests. */
 /* WARNING: before changing this, check that shared_info fits on a page */
 #define MAX_VIRT_CPUS 64